<?php

namespace App\Models;

class DailyReportStatistics extends Base
{
    /**
     * 订单相关累计
     * @param $amount
     * @param string $method
     * @param int $numberOfOrder
     */
    public function incrementOrDecrementOrderRelated($amount, $method = 'increment', $numberOfOrder = 1)
    {
        $amount > 0 && $this->{$method}('total_amount_of_orders', $amount);
        $numberOfOrder > 0 && $this->{$method}('number_of_order', $numberOfOrder);
    }

    /**
     * 充值相关累计
     * @return int|void
     */
    public function incrementOrDecrementTopUp($amount, $method = 'increment')
    {
        $amount > 0 && $this->{$method}('total_recharge_amount', $amount);
    }

    /**
     * 代理商相关累计
     * @param $amount
     * @param string $method
     */
    public function incrementOrDecrementAgent($amount = 1, $method = 'increment')
    {
        $amount > 0 && $this->{$method}('total_number_of_new_agents', $amount);
    }
}
